package com.hiray.wanandroid.net.response

import com.google.gson.annotations.SerializedName
import org.apache.commons.text.StringEscapeUtils

data class HomeFeed(
    var title: String,
    val link: String,
    val id: String?,
    val author: String,
    val shareUser: String,
    val niceDate: String,
    val isNew: Boolean = false,
    val source: String? = "",
    var liked: Boolean = false,
    val tags: List<FeedTag> = emptyList()
) {
    var isPinned: Boolean = false

    private var unescapedTitle: String? = null

    fun unescapedTitle(): String {
        if (unescapedTitle == null)
            unescapedTitle = StringEscapeUtils.unescapeHtml4(title)
        return unescapedTitle!!
    }
}

data class FeedTag(val name: String, @SerializedName("url") val urlSegment: String)